using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_User : System.Web.UI.Page
{
	protected void Page_Load(object sender, EventArgs e)
	{
		this.UserForm1.BackClick += new EventHandler(UserForm1_BackClick);
		this.UserForm1.AfterSave += new IWS.Lib.Utilities.Web.FormControl.SaveEventHandler(UserForm1_AfterSave);
		this.UserForm1.DeleteClick += new EventHandler(UserForm1_DeleteClick);

		string userid = Request.QueryString["username"];

		if (!Page.IsPostBack)
		{
			this.UserRolesList1.Visible = userid != null;
			this.UserForm1.LoadUser(userid);

			if (userid != null)
				this.UserRolesList1.LoadRolesByUser(userid);
		}
	}

	void UserForm1_DeleteClick(object sender, EventArgs e)
	{
		Response.Redirect("~/Admin/Users.aspx");
	}

	void UserForm1_AfterSave(object sender, IWS.Lib.Utilities.Web.SaveEventArgs e)
	{
		this.UserForm1.LoadUser(e.NewID.ToString());
		this.UserRolesList1.Visible = true;
		this.UserRolesList1.LoadRolesByUser(e.NewID.ToString());
	}

	void UserForm1_BackClick(object sender, EventArgs e)
	{
		Response.Redirect("~/Admin/Users.aspx");
	}
}
